#!/bin/bash

# 设置项目名称和主入口文件路径
set APP_NAME=SM4ZServer
set MAIN_PKG=./main.go

# Linux amd64 (64-bit)
export GOOS=linux
export GOARCH=amd64
go build -ldflags="-s -w" -o "${APP_NAME}-linux-${GOARCH}" "$MAIN_PKG"

# Windows amd64 (64-bit)
export GOOS=windows
export GOARCH=amd64
go build -ldflags="-s -w" -o "${APP_NAME}-windows-${GOARCH}.exe" "$MAIN_PKG"

# Windows 386 (32-bit)
export GOOS=windows
export GOARCH=386
go build -ldflags="-s -w" -o "${APP_NAME}-windows-${GOARCH}.exe" "$MAIN_PKG"

echo "打包完成，生成的可执行文件位于当前目录："
ls -l ${APP_NAME}-*.{exe}